#!/user/bin/env python3
# -*- coding: utf-8 -*-

'''
对Lena图像进行平均滤波、高斯滤波、中值滤波，病调整参数的不同分析平滑效果
'''

import cv2 as cv

filename = r'D:\data\lena.jpg'
src = cv.imread(filename)
#cv.imshow("input image", src)

#平均滤波
# blur_image = cv.blur(src, (3, 3))
# cv.imshow("3x3均值滤波", blur_image)
# blur_image = cv.blur(src, (5, 5))
# cv.imshow("5x5均值滤波", blur_image)
# blur_image = cv.blur(src, (7, 7))
# cv.imshow("7x7均值滤波", blur_image)
#高斯滤波
gauss_image = cv.GaussianBlur(src, (3, 3), 0)
cv.imshow("3x3 Guassion Blur", gauss_image)
gauss_image = cv.GaussianBlur(src, (5, 5), 0)
cv.imshow("5x5 Guassion Blur", gauss_image)
gauss_image = cv.GaussianBlur(src, (7, 7), 0)
cv.imshow("7x7 Guassion Blur", gauss_image)
gauss_image = cv.GaussianBlur(src, (3, 7), 0)
cv.imshow("3x7 Guassion Blur", gauss_image)
#中值滤波
# med_image = cv.medianBlur(src, 3)
# cv.imshow("3 Median Blur", med_image)
# med_image = cv.medianBlur(src, 7)
# cv.imshow("7 Median Blur", med_image)
# med_image = cv.medianBlur(src, 11)
# cv.imshow("11 Median Blur", med_image)

# fastN_image = cv.fastNlMeansDenoisingColored(src, None, 15, 15, 10, 30)
# cv.imshow("fastNlMeansDenoisingColored", fastN_image)

cv.waitKey(0)
cv.destroyAllWindows()